package com.kyle.controller;

import com.kyle.pojo.Stu;
import com.kyle.service.StuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author：kyle_fu
 * @description: TODO
 * @Date：2024/1/7 11:02
 * @version: 1.0
 */
@RestController
@RequestMapping(value ="u")
@Slf4j
public class HelloController {

    @Autowired
    private StuService stuService;
    @Value("${server.port}")
    private String port;
    @GetMapping(value = "/stu")
    public String stu(){

        Stu stu = new Stu();
        stu.setAge(18);
        stu.setName("kyle");

        stuService.save(stu);
        return "ok";
    }

    @GetMapping(value = "/hello")
    public String hello(){
        log.info("lb测试,当前端口号为" +port );
        return "hello userService~~~";
    }

}
